def reverse_string(string) # method reverse_string with parameter 'string'
  loop = string.length # int loop is equal to the string's length
  word = '' # this is what we will use to output the reversed word
  while loop > 0 # while loop is greater than 0, subtract loop by 1 and add the string's index of loop to 'word'
    loop -= 1 # subtract 1 from loop
    word += string[loop] # add the index with the int loop to word
  end # end while loop
  return word # return the reversed word
end # end the method

# Example implementation:
puts reverse_string("reversethis")
# Output: sihtesrever
